]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-app: Do not allocate memory during GSpawnChildSetupFunc
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 30 Apr 2024 21:45:04 +0000 (23:45 +0200)
committerMarge Bot <marge-bot@gnome.org>
Fri, 24 May 2024 22:48:53 +0000 (22:48 +0000)
The child context setup function used as launch GSpawnChildSetupFunc
uses g_object_get that internally potentially allocates memory, making
it not async-signal-safe and so not something that is safe to use in
between fork and exec, so just use the simpler getter here.

Note that the current implementation of app_child_setup() is safe
already as sd_journal_stream_fd, dup2 and close are so.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3293>

src/shell-app.c

index 3b5df0aabbac4e07705f831d9cbe9cc28e1e8494..dcebc97daf59ce9a9a32b257001609868461d5cf 100644 (file)
@@ -1236,9 +1236,8 @@ static void
 child_context_setup (gpointer user_data)
 {
   ShellGlobal *shell_global = user_data;
-  MetaContext *meta_context;
+  MetaContext *meta_context = shell_global_get_context (shell_global);
 
-  g_object_get (shell_global, "context", &meta_context, NULL);
   meta_context_restore_rlimit_nofile (meta_context, NULL);
 }